package com.wgy.designmode.action.state.context;

import com.wgy.designmode.action.state.state.CloseState;
import com.wgy.designmode.action.state.state.StartState;
import com.wgy.designmode.action.state.state.State;

public class Computer {


    private State state = new CloseState();

    public State getState() {
        return state;
    }

    private void setState(State state) {
        this.state = state;
    }

    public void powerOn() {
        state.powerOn(this);
        this.setState(new StartState());
    }

    public void powerOff() {
        state.powerOff(this);
        this.setState(new CloseState());
    }

    public void play() {
        state.play(this);
    }
}
